package cn.zd.demo1.sql.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import cn.zd.demo1.sql.entity.TabUserInfoEntity;

@Dao
public interface TabUserInfoDao {
    @Insert
    void insert(TabUserInfoEntity... entities);
    @Delete
    void delete(TabUserInfoEntity... entities);
    @Update
    void update(TabUserInfoEntity... entities);
    @Query("select * from TabUserInfoEntity")
    List<TabUserInfoEntity> queryAll();
    @Query("delete from TabUserInfoEntity")
    int deleteAll();
    @Query("select * from TabUserInfoEntity where userName = :name ")
    List<TabUserInfoEntity> queryByName(String name);

    @Query("update TabUserInfoEntity set userName = :newUserName where userName = :oldUserName")
    void update(String newUserName, String oldUserName);

    @Query("update TabUserInfoEntity set userName = :newUserName")
    void updateAll(String newUserName);

    @Query("delete from TabUserInfoEntity where userName = :userName ")
    void deleteByName(String userName);
}
